import axios from 'axios';
import {SET_VOTELIST,SELECTED} from '../../store/types/vote';

export const getVoteList = () => {
    return (dispatch:any) =>{
        axios.get('/api/votelist').then(res => {
            // this.props.setVote(res.data.data);
            dispatch({type:SET_VOTELIST,list:res.data.data})
        })
     }
}

//触发投票
export const selected = (id:number,optionId:number,name:string) => {
    return {
        type:SELECTED,
        id,
        optionId,
        name
    }
}
